package com.rxy.demo.controller;

import com.rxy.demo.pojo.DO.UserInfo;
import com.rxy.demo.pojo.VO.UserAddressClassVO;
import com.rxy.demo.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private UserService userService;

    @PostMapping("/register")
    public String register(@RequestBody UserAddressClassVO userAddressClassVO){
        return userService.register(userAddressClassVO);
    }

    @PostMapping("/login")
    public Object login(@RequestBody UserInfo userInfo){
        if (userService.Login(userInfo)!=null){
            return userService.Login(userInfo);
        }else{
            return "登录失败";
        }
    }
}
